package cn.ryanpenn.javafx.samples.javafxui;

import javafx.scene.image.Image;

import java.net.URL;

/**
 * AssetsUtils
 */
public class AssetsUtils {

    private AssetsUtils(){}

    public static URL getResource(String path){
        return AssetsUtils.class.getClassLoader().getResource(path);
    }

    public static Image getImage(String fileName){
        return new Image(AssetsUtils.class.getClassLoader().getResourceAsStream("assets/image/" + fileName));
    }

    public static URL getStyle(String fileName){
        return getResource("assets/style/" + fileName);
    }

    public static URL getLayout(String fileName){
        return getResource("assets/layout/" + fileName);
    }
}
